package com.hxgis.oc.util.ds;

import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

public class SQLiteDataSource {

    public static JdbcTemplate createJdbcTemplate(String url) {
        DataSourceBuilder<?> builder = DataSourceBuilder.create();
        builder.driverClassName("ogr.sqlite.JDBC");
        builder.url("jdbc:sqlite:" + url);
        builder.type(org.sqlite.SQLiteDataSource.class);
        DataSource ds =  builder.build();
        return new JdbcTemplate(ds);
    }
}
